<?php
class Base_model extends CI_Model {

	protected $tablename;
	function __construct() {
		parent::__construct();
		$this->load->database();

	}
	function fetch($array = NULL, $flag = false) {
		if (is_null($array)) {
			$query = $this->db->get($this->tablename);
			if ($flag === false)
				return $query->result();
			return $query->result_array();
		}
		$query = $this->db->get_where($this->tablename, $array);
		
		if ($flag === false)
				return $query->result();
			return $query->result_array();
	}
	function add($array) {
		return $this->db->insert($this->tablename, $array);

	}
}

?>